package com.bosch.in.rtp1.ept.model.dto;

import java.util.List;

import net.sf.json.JSONArray;

/**
 * LotStatus data in JSON format which is supported to display in Jqgrid.
 * @author TPR1HC
 *
 */
public class JqgridJsonData {
	
	/**
     * store the current page on Jqgrid
     */
    private int page;
    
    /**
     * contains total number of returned records.
     */
    private int totalRecords;
    
    /**
     * indicates how many record is displayed in one page.
     */
    private int rowNum;
    
    /**
     * store list of LotStatus in JSON format 
     */
    private List<JSONArray> rows;
    
    /**
	 * @return current page
	 */
	public String getPage() {
		return String.valueOf(page);
	}
	
	/**
	 * 
	 * @param page
	 */
	public void setPage(int page) {
		this.page = page;
	}

	/**
	 * 
	 * @return total page
	 */
	public int getTotal() {
		int totalPage = 0;
		if (rowNum != 0) {
			totalPage = totalRecords/rowNum;
			if (totalRecords % rowNum != 0) {
				totalPage++;
			}
		}
		return totalPage;
	}
	
	public void setRowNum(int rowNum) {
		this.rowNum = rowNum;
	}

	/**
	 * 
	 * @return total number of record matching search criteria
	 */
	public String getRecords() {
		return String.valueOf(totalRecords);
	}
	
	/**
	 * 
	 * @param totalRecords
	 */
	public void setRecords(int totalRecords) {
		this.totalRecords = totalRecords;
	}
	
	/**
	 * 
	 * @return list of LotStatus in JSON format
	 */
	public List<JSONArray> getRows() {
		return rows;
	}
	/**
	 * 
	 */
	public void setRows(List<JSONArray> rows) {
		this.rows = rows;
	}
}
